<template>
    <div >
     <h1>来了老弟</h1>
     <section class="output-wrap">
    <iframe
      class="scan"
      id="scan"
      name="scan"
      src
      frameborder="0"
      width="100%"
      height="100%"
      scrolling="no"
    ></iframe>
  </section>
    </div>
</template>
<script>

export default {
    
 
    data(){
        return {
            html:this.$route.query.code 
        }
    },
    mounted(){
       this.write()
    },
    methods:{
        write(){
            // if(this.html == undefined || this.html == null){
            //     this.html = '';
            // }
            // document.write(this.html)
             const iframe = document.getElementById("scan");
            iframe.contentWindow.document.open();
      iframe.contentWindow.document.write(this.html);
      iframe.contentWindow.document.close();
        }
    },
    //侦听器
    watch:{
        html:function(newHtml,oldHtml){
            console.log(newHtml,oldHtml)
            this.html = newHtml;
            this.write();
        }
    },
   
  
  
    

}
</script>